import { invateCustomer, visitedCustomer, signedCustomer, loanCustomer } from '@/api';
import { getSessionUser } from '@/utils';
interface Props {
  businessType: 'invation' | 'visited' | 'signed' | 'loan'
  editItem: any
  // invateCustomer: (data: any) => void
}
export const getBusinessConfig = ({
  businessType,
  editItem,
}: Props) => {
  const { userId } = getSessionUser();
  const { customerId, customerOrderId } = editItem
  const config = {
    'invation': {
      title: '邀约',
      reqFixParams: {
        customerId,
        userId
      },
      formList: [
        {
          title: '',
          Items: [
            {
              label: '邀约上门时间',
              name: 'expectVisitTime',
              type: 'datePicker',
              format: 'timeStamp',
              rules: [
                { required: true },
              ]
            },
            {
              label: '备注',
              name: 'remark',
              type: 'input',
            },
          ],
        }
      ],
      submitFn: invateCustomer
    },
    'visited': {
      title: '上门',
      reqFixParams: {
        customerOrderId,
        userId
      },
      formList: [
        {
          title: '',
          Items: [
            {
              label: '实际上门时间',
              name: 'actualVisitTime',
              type: 'datePicker',
              format: 'timeStamp',
              rules: [
                { required: true },
              ]
            },
            {
              label: '备注',
              name: 'remark',
              type: 'input',
            },
          ],
        }
      ],
      submitFn: visitedCustomer
    },
    'signed': {
      title: '签单',
      reqFixParams: {
        customerOrderId,
        userId
      },
      formList: [
        {
          title: '',
          Items: [
            {
              label: '签单时间',
              name: 'expectLoanLimitTime',
              type: 'datePicker',
              format: 'timeStamp',
              rules: [
                { required: true },
              ]
            },
            {
              label: '预约贷款金额',
              name: 'expectLoanLimit',
              type: 'input',
            },
            {
              label: '备注',
              name: 'remark',
              type: 'input',
            },
          ],
        }],
      submitFn: signedCustomer,
    },
    'loan': {
      title: '放款',
      reqFixParams: {
        customerOrderId,
        userId
      },
      formList: [
        {
          title: '',
          Items: [
            {
              label: '实际放款时间',
              name: 'actualLoanLimitTime',
              type: 'datePicker',
              format: 'timeStamp',
              rules: [
                { required: true },
              ]
            },
            {
              label: '放款金额',
              name: 'actualLoanLimit',
              type: 'input',
            },
            {
              label: '备注',
              name: 'remark',
              type: 'input',
            },
          ],
        }],
      submitFn: loanCustomer,
    }
  }
  return config[businessType];
}